-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: afterCreateUser
callback being called before setting user's roles
#30309
Conversation
afterCreateUser
callback being called before setting user's roles
2cf82c6
to
32e0068
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #30309 +/- ##
===========================================
+ Coverage 51.16% 54.84% +3.68%
===========================================
Files 2026 2276 +250
Lines 46638 50407 +3769
Branches 9486 10274 +788
===========================================
+ Hits 23861 27646 +3785
+ Misses 20562 20287 -275
- Partials 2215 2474 +259
Flags with carried forward coverage won't be shown. Click here to find out more. |
🦋 Changeset detectedLatest commit: d9474b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thanks @pierre-lehnen-rc 🙌 Appreciate your insights and help on this item :) |
Looks like this PR is ready to merge! 🎉 |
|
||
if (Match.test(user.globalRoles, [String]) && user.globalRoles.length > 0) { | ||
globalRoles.push(...user.globalRoles); | ||
user.globalRoles.map((role) => globalRoles.add(role)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user.globalRoles.forEach((role) => globalRoles.add(role));
Proposed changes (including videos or screenshots)
Issue(s)
https://rocketchat.atlassian.net/browse/OC-1276
https://rocketchat.atlassian.net/browse/SUP-541
Steps to test or reproduce
Further comments
This fixes a problem with Business Hours, where the callback for updating agents and assign the proper open business hours was not being fired because
afterCreateUser
was being called way before setting the roles for a user.This caused the callback to ignore the user and thus not updating its
openBusinessHours
, making the user unavailable to enable its status.